package com.tanhua.manager.controller;

import com.tanhua.manager.service.ManageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/manage")
public class ManageController {

    @Autowired
    private ManageService manageService;

    @GetMapping(value = "/users",name = "分页查询用户")
    public ResponseEntity queryUsers(@RequestParam(defaultValue = "1") Integer page,
                                     @RequestParam(defaultValue = "10")Integer pagesize,
                                     Long id,
                                     String nickname,
                                     String city){
        return manageService.queryUsers(page,pagesize,id,nickname,city);
    }

    /**
     * 获取用户位置
     * @param userId
     * @return
     */
    @GetMapping(value = "/location/{userId}")
    public ResponseEntity queryUserLocation(@PathVariable("userId") Long userId) {

        return manageService.queryUserLocation(userId);
    }
}
